STEP 10: Now that we have code for when the player misses the goal, let's write code for when there is a goal.

An else block runs if the statement above it does not run.

  • In LOGIC, go to and drag in Else. Make sure your else looks like this: ····else:
  • In GRAPHICS, go to and drop Glide To indented twice INSIDE your else block.
  • Change the variable name in front to ball and the arguments in the parentheses to (175, random_height).

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)